{% call macros.panel("info", "Step 3 - expose Mailu to the world") %}
<p>A mail server must be exposed to the world to receive emails, send emails,
and let users access their mailboxes. Mailu has some flexibility in the way
you expose it to the world.</p>

<p>Among Mailu services, the <em>front</em> server is the one accepting connections,
be it directly from the outside world, through a reverse proxy or in any
complex configuration that you might want to set up. It needs to listen on some
IP addresses in order to expose its public services. You must at least set up
an IPv4 or an IPv6 address if you wish to access Mailu.</p>

<p><span class="label label-warning">Warning</span> You must use specific addresses, please
avoid generic all-interfaces addresses like <code>0.0.0.0</code> or <code>::</code>. If you still want to use generic addresses you <b>MUST</b> disable <code>userland-proxy</code>; failing to do so will turn your Mailu installation into an open-relay.
<a href="https://mailu.io/{{ version }}/compose/setup.html#bind-address">How to find these addresses.</a> <a href="https://mailu.io/{{ version }}/faq.html#how-to-make-ipv6-work">How to disable userland-proxy.</a></p>

<div class="form-group">
  <label>IPv4 listen address</label>
<!--   Validates IPv4 address -->
  <input class="form-control" type="text" name="bind4" value="127.0.0.1" >
  <label>Subnet of the docker network. This should not conflict with any networks to which your system is connected. (Internal and external!)
    Usually the format is '*.*.*.0/24'</label>
  <input class="form-control" type="text" name="subnet" value="192.168.203.0/24">
</div>

<div class="form-check form-check-inline">
  <label class="form-check-label">
    <input class="form-check-input" type="checkbox" name="ipv6_enabled" value="true" id="enable_ipv6">
    Enable IPv6
  </label>
</div>

<div class="form-group" id="ipv6" style="display: none">
  <p><span class="label label-danger">Read this:</span> Docker currently does not expose the IPv6 ports properly, as it does not interface with <code>ip6tables</code>. Read <a href="https://mailu.io/{{ version }}/faq.html#how-to-make-ipv6-work">FAQ section</a> and be <b>very careful</b>. We do <b>NOT</b> recommend that you enable this!</p>
  <label>IPv6 listen address</label>
<!--   Validates IPv6 address -->
  <input class="form-control" type="text" name="bind6" value="::1" >
  <label>Subnet of the docker network. This should not conflict with any networks to which your system is connected. (Internal and external!)</label>
  <input class="form-control" type="text" name="subnet6" required value="{{ subnet6 }}:beef::/64">
</div>

<div class="form-check form-check-inline">
  <p>The unbound resolver enables Mailu to do DNSSEC verification, DNS root lookups and caching. This also helps the antispam service not to get blocked by the public or ISP DNS servers.</p>
  <label class="form-check-label">
    <input class="form-check-input" type="checkbox" id="resolver_enabled" name="resolver_enabled" value="true" checked>
    Enable an internal DNS resolver (unbound)
  </label>
</div>
<div class="form-group" id="unbound" style="display: none">
	<p><span class="label label-danger">Read this:</span> Mailu requires a <b>validating, DNSSEC-enabled</b> DNS resolver</b> to function. Be sure to read our <a href="https://mailu.io/{{ version }}/faq.html#the-admin-container-won-t-start-and-its-log-says-critical-your-dns-resolver-isn-t-doing-dnssec-validation">FAQ entry</a> on the topic.</p>
</div>

<p>Your server will be available under a main hostname but may expose multiple public
hostnames. Every e-mail domain that points to this server must have one of the
hostnames in its <code>MX</code> record. Hostnames must be comma-separated. If you're having
trouble accessing your admin interface, make sure it is the first entry here (and possibly the
same as your <code>DOMAIN</code> entry from earlier). Also make sure that the first entry in
this list resolves to the IP address of your server, and that the reverse DNS entry for
the IP address of your server resolves to this first entry in this list.</p>

<div class="form-group">
  <label>Public hostnames</label>
<!--   Validates hostname or list of hostnames -->
  <input class="form-control" type="text" name="hostnames" placeholder="my.host.name,other.host.name" multiple required
    	pattern="^(?:(?:\w+(?:-+\w+)*\.)+[a-z]+)*(?:,(?:(?:\w+(?:-+\w+)*\.)+[a-z]+)\s*)*$">
</div>
{% endcall %}
